﻿using System;

using Game.Map;
using Game.Objects;
using Game.Types;

namespace Game.Editor.Toolbox
{
    public class SelectedInfrastructureEventArgs : EventArgs
    {
        public ObjectType ObjectType
        {
            get; set;
        }
    }
    
    public static class SelectedInfrastructure
    {
        public static event EventHandler<SelectedInfrastructureEventArgs> Selected;
        
        static ObjectType _ObjectType;
        
        public static ObjectType ObjectType
        {
            get { return _ObjectType; }
            set 
            {
                if (_ObjectType != value)
                {
                    _ObjectType = value; 
                    FireSelected();
                }
            }
        }
        
        static void FireSelected()
        {
            if (Selected != null)
            {
                SelectedInfrastructureEventArgs args = 
                    new SelectedInfrastructureEventArgs();
                args.ObjectType = _ObjectType;
                Selected(_ObjectType, args);
            }
        }
        
    }
}
